﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.IO;
using BasePlatformCommon;

namespace L9SubSet {
    public partial class Form_ReadLwfPara : Form {
        Form_MainSet parent;
        private string section = "ReadLwfPara";
        public Form_ReadLwfPara(Form_MainSet parent) {
            InitializeComponent();
            this.parent = parent;
            this.StartPosition = FormStartPosition.CenterParent;

            setLanguageText();
        }

        private void readLampParaButton_Click(object sender, EventArgs e) {
            parent.readLampParaButtonClick();
        }

        public void UpdateLwfPara(int hPoints, int vPoints, int subNum, int lampNum) {
            if (InvokeRequired) {
                this.Invoke(new Action(() => { UpdateLwfPara(hPoints, vPoints, subNum, lampNum); }));
            } else {
                xPointTextBox.Text = hPoints.ToString();
                yPointTextBox.Text = vPoints.ToString();
                subControlNumTextBox.Text = subNum.ToString();
                totalLampNumTextBox.Text = lampNum.ToString();
            }
        }

        public void setLanguageText() {
            if (LanguageOper.available == false) {
                return;
            }

            LanguageOper.SetCurrentCulture();

            this.Text = LanguageOper.ReadValue(section, "ReadLwfPara.Text");
            hPointLabel.Text = LanguageOper.ReadValue(section, "hPointLabel.Text");
            vPointLabel.Text = LanguageOper.ReadValue(section, "vPointLabel.Text");
            subNumLabel.Text = LanguageOper.ReadValue(section, "subNumLabel.Text");
            lampNumLabel.Text = LanguageOper.ReadValue(section, "lampNumLabel.Text");
            readLampParaButton.Text = LanguageOper.ReadValue(section, "readLampParaButton.Text");
        }
    }
}
